package com.adteam.xmap.web;

import java.util.List;

import com.adteam.xmap.entity.News;
import com.adteam.xmap.manager.NewsManager;
import com.opensymphony.xwork2.ActionSupport;

public class NewsAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	
	private NewsManager newsManager;
	
	private News news;
	
	private List newses;
	
	private Integer id;

	@Override
	public String execute() throws Exception {
		
		newses = newsManager.findAllNewses();
		return "SUCCESS";
	}
	
	public String addInput() {
		
		return "add_input";
	}
	
	public String add() {
		
		newsManager.addNews(news);
		return "add_success";
	}
	
	public String del() {
		
		newsManager.delNews(id);
		return "del_success";
	}
	
	public String updateInput() {
		
		return "update_input";
	}
	
	public String update() {
		
		newsManager.updateNews(news);
		return "update_success";
	}
	
	public String find() {
		
		news = newsManager.findNewsById(id);
		return "find_success";
	}

	public NewsManager getNewsManager() {
		return newsManager;
	}

	public void setNewsManager(NewsManager newsManager) {
		this.newsManager = newsManager;
	}

	public News getNews() {
		return news;
	}

	public void setNews(News news) {
		this.news = news;
	}

	public List getNewses() {
		return newses;
	}

	public void setNewses(List newses) {
		this.newses = newses;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

}
